﻿/**
 * Peter
 * Created by: Peter Development Team
 *    http://peter.codeplex.com/
 * 
 * GNU General Public License version 2 (GPLv2)
 *    http://peter.codeplex.com/license
 *
 *  This code is provided on an AS IS basis, with no WARRANTIES,
 *  CONDITIONS or GUARANTEES of any kind.
 *
 **/

using System.Windows;
using System.Windows.Controls;
using Peter.Common.Interfaces;

namespace Peter.Common
{
   /// <summary>
   /// Selector for the docking styles in peter.
   /// </summary>
   public class DockStyleSelector : StyleSelector
   {
      /// <summary>
      /// Gets or Sets the default style.
      /// </summary>
      public Style DefaultStyle { get; set; }

      /// <summary>
      /// Gets or Sets the document style.
      /// </summary>
      public Style DocumentStyle { get; set; }

      /// <summary>
      /// Gets or Sets the tool window style.
      /// </summary>
      public Style ToolWindowStyle { get; set; }

      /// <summary>
      /// When overridden in a derived class, returns a <see cref="T:System.Windows.Style"/> based on custom logic.
      /// </summary>
      /// <returns>
      /// Returns an application-specific style to apply; otherwise, null.
      /// </returns>
      /// <param name="item">The content.</param>
      /// <param name="container">The element to which the style will be applied.</param>
      public override Style SelectStyle (object item, DependencyObject container)
      {
         if (item is IPeterDocument)
            return this.DocumentStyle;
         if (item is IPeterToolWindow)
            return this.ToolWindowStyle;
         return this.DefaultStyle;
      }
   }
}
